<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="breadcrumbs">
        <h:form>
            <a href="index.xhtml">Website Admin</a><div class="breadcrumb_divider"></div>
            <h:commandLink action="#{usersController.prepareList()}" value="Users"/><div class="breadcrumb_divider"></div>
            <h:commandLink value="Create" class="current"/>
        </h:form>
        </ui:define>
        <ui:define name="body">
             <h:form id="form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorClass="errorStyle" infoClass="infoStyle" layout="table"/>
            </h:panelGroup>
            <article class="module width_full">
                    <header><h3>Create User</h3></header>
                    <div class="module_content">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateUsersLabel_username}" for="username" />
                    <p:inputText id="username" value="#{usersController.selected.username}" title="#{bundle.CreateUsersTitle_username}" required="true" requiredMessage="#{bundle.CreateUsersRequiredMessage_username}"/>
                    <h:outputLabel value="#{bundle.CreateUsersLabel_firstName}" for="firstName" />
                    <p:inputText id="firstName" value="#{usersController.selected.firstName}" title="#{bundle.CreateUsersTitle_firstName}" />
                    <h:outputLabel value="#{bundle.CreateUsersLabel_lastName}" for="lastName" />
                    <p:inputText id="lastName" value="#{usersController.selected.lastName}" title="#{bundle.CreateUsersTitle_lastName}" />
                    <h:outputLabel value="#{bundle.CreateUsersLabel_password}" for="password" />
                    <p:password id="password" value="#{usersController.selected.password}" feedback="true"   
                        promptLabel="weak medium strong" weakLabel="weak"  
                        goodLabel="Good" strongLabel="Strong" />
                    <h:outputLabel value="Confirm password:" for="confirmPassword" />
                    <p:password id="confirmPassword" value="#{usersController.confirmPass}"/>
                    <h:outputLabel value="Group:" for="groupId" />
                    <p:selectOneMenu id="groupId" value="#{usersController.selected.groupId}" effect="fold">
                        <f:selectItems value="#{usersController.listCourse}" var="group" itemLabel="#{group}" itemValue="#{group}"/>
                    </p:selectOneMenu>
                </h:panelGrid>
                <div align="right">
                    <h:commandButton action="#{usersController.create}" value="#{bundle.CreateUsersSaveLink}" />
                </div>
                </div></article>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
